/*!
 * home.js
 * @project MB Consultoria Jurídica
 * @developer Thiago Braga <thibraga06@gmail.com>
 * @url www.mbconsultoriajuridica.com.br
 */


/**
 * @function _carousel
 * @description Instantiates the Bootstrap Carousel plugin.
 * @uses Bootstrap 2.3.2
 */
var _carousel = (function () {
  var slider = $('.carousel');
  slider.carousel({ interval: 5000 });
})();


/**
 * @function loadNews
 * @description Read RSS content via ajax and write on page.
 * @uses jGFeed Plugin
 */
var loadNews = (function () {
  var feeds = feeds || {},
    news = $('#news'),
    loading = news.parent().find('.icon-spinner');

  $.jGFeed('http://www.oab.org.br/rss', function (feeds) {
    if (!feeds)
      return false;

    for (var i = 0; i < feeds.entries.length; i++) {
      var entry = feeds.entries[i];
      news.append('<li><a href="'+ entry.link +'" target="_blank">'+ entry.title +'</a></li>');
    }
    loading.hide();
  }, 10);
})();